﻿Imports System
Imports System.Resources
Imports System.Reflection
Imports System.Threading
Imports System.Globalization
Imports System.Data.OleDb
Imports System.Collections

Imports MMUtil.clsGeneral
Imports MMUtil.clsGeneral.ControlType
Imports MMUtil.clsLocalization

Public Class Form1

    Dim utLocal As MMUtil.clsLocalization
    Dim utGen As MMUtil.clsGeneral

    ' Control.tag 속성에 ResourceID를 넣어준다.
    Private Sub btnChangeLan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnChangeLan.Click

        ' single control 자동변환
        'utLocal.Translate(Button1)
        ' multi control 자동변환
        utLocal.Translate(Panel1)
        ' single control 수동변환
        utLocal.Translate(Button1, "LB_TITLE")

    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        With cbMultiLang
            .Items.Add("ko-KR")
            .Items.Add("en-US")
            .Text = "ko-KR"
        End With

        Dim ci As New CultureInfo(cbMultiLang.Text, False)
        utLocal = New MMUtil.clsLocalization("Test.TestResources", ci)
        utGen = New MMUtil.clsGeneral

    End Sub

    Private Sub btnSearchObject_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSearchObject.Click

        MsgBox("검색된 Object의 Text내용 : " + FindSingleObject(Me, txtSearchObject.Text).Text)

    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click

        FindSingleObject(Me, "TextBox", 0).Text = "검색"

    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        Dim str As String = utLocal.Translate(TextBox1.Text)
        MsgBox(str)
    End Sub

    Private Sub cbMultiLang_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbMultiLang.SelectedIndexChanged
        If Not utLocal Is Nothing Then
            Dim ci As New CultureInfo(cbMultiLang.Text, False)
            utLocal.SetCultureInfo(ci)
        End If
    End Sub
End Class
